package com.xzj.admin.analysis.base.custom.it;

import com.xzj.admin.analysis.base.common.handle.ThemeSpecialAnalysisHandle;
import com.xzj.admin.analysis.base.custom.common.PlatformSpecialHandle;

/**
 * @program: xzj-admin
 * @ClassName: VcThemeSpecialAnalysisHandle
 * @description: IT-VC特殊主题处理器
 * @author: XiaZunJun
 * @create: 2024-11-20 14:23
 */
public class CasThemeSpecialAnalysisHandle extends ThemeSpecialAnalysisHandle {

    static {
        putThemeSpecialHandle(buildKey(RESOURCE_TYPE.region.name(), MESSAGE_TAG.add.name()), PlatformSpecialHandle::regionAdd);
        putThemeSpecialHandle(buildKey(RESOURCE_TYPE.region.name(), MESSAGE_TAG.edit.name()), PlatformSpecialHandle::regionAdd);
        putThemeSpecialHandle(buildKey(RESOURCE_TYPE.datacenter.name(), MESSAGE_TAG.add.name()), PlatformSpecialHandle::datacenterAdd);
        putThemeSpecialHandle(buildKey(RESOURCE_TYPE.datacenter.name(), MESSAGE_TAG.edit.name()), PlatformSpecialHandle::datacenterAdd);
        putThemeSpecialHandle(buildKey(RESOURCE_TYPE.host.name(), MESSAGE_TAG.add.name()), PlatformSpecialHandle::vmOrHostAdd);
        putThemeSpecialHandle(buildKey(RESOURCE_TYPE.host.name(), MESSAGE_TAG.edit.name()), PlatformSpecialHandle::vmOrHostAdd);
        putThemeSpecialHandle(buildKey(RESOURCE_TYPE.vm.name(), MESSAGE_TAG.add.name()), PlatformSpecialHandle::vmOrHostAdd);
        putThemeSpecialHandle(buildKey(RESOURCE_TYPE.vm.name(), MESSAGE_TAG.edit.name()), PlatformSpecialHandle::vmOrHostAdd);
    }

    public CasThemeSpecialAnalysisHandle(String cloudId, String cloudType) {
        super(cloudId, cloudType, message ->
                RESOURCE_TYPE.host.equals(message.getMessageSource())
                        || RESOURCE_TYPE.vm.equals(message.getMessageSource())
                        || RESOURCE_TYPE.datacenter.equals(message.getMessageSource())
                        || RESOURCE_TYPE.region.equals(message.getMessageSource())
        );
    }
}
